//  -------------------- iSharePoint -------------------- //
// 
//  Company:	IT Complex, LLC
//  Project:	Smart.Common
//  File name:	MetaSqlColumn.cs
//  Developer:	Solomatov Igor
//  Created:	15.04.2012
// 
//  -------------------- iSharePoint -------------------- //

using System;
using System.Diagnostics;
using Microsoft.SharePoint;

namespace Smart.Common
{
	/// <summary>
	/// Metadata for SQL Server column
	/// </summary>
	[DebuggerDisplay("MetaSqlColumn Name={Name} Title={Title}")]
	public class MetaSqlColumn : MetaField
	{
		/// <summary>
		/// Return guid for column id
		/// </summary>
		private static Guid GetColumnGuid(int id)
		{
			return new Guid((uint) id, 0xE44A, 0x433C, 0, 0, 0, 0, 0, 0, 0, 0);
		}

		/// <summary>
		/// Column ID
		/// </summary>
		public int ColumnID { get; set; }

		/// <summary>
		/// Is identity column
		/// </summary>
		public bool IsIdentity { get; set; }

		/// <summary>
		/// Is computed column
		/// </summary>
		public bool IsComputed { get; set; }

		/// <summary>
		/// Metadata for SQL Server column
		/// </summary>
		public MetaSqlColumn(int id, string name, SPFieldType type, MetaList list)
			: base(GetColumnGuid(id), name, name, type, list)
		{
			ColumnID = id;
		}
	}
}